package tq.com.tqim.net;

import java.util.HashMap;
import java.util.Map;

public class TQImRequest {
    static private String TAG = "TQImRequest";

    static public void loginIm(String name, String pwd, TQImCallback callback){
        Map<String, String> map = new HashMap<>();
        map.put("name", name);
        map.put("pwd", pwd);

        TQImHttpBase.client().post("/user/auth/signin", map, callback);
    }

    static public void registerIm(String name, String pwd, TQImCallback callback){
        Map<String, String> map = new HashMap<>();
        map.put("name", name);
        map.put("pwd", pwd);

        TQImHttpBase.client().post("/user/auth/register", map, callback);
    }

    static public void search(String info, TQImCallback callback){
        Map<String, String> param = new HashMap<>();
        param.put("kw", info);

        TQImHttpBase.client().post("/user/auth/searchx", param, callback);
    }

    //(结尾的 / 不可省略)
    static public void getContact(TQImCallback callback){
        TQImHttpBase.client().get("/user/contacts/", null, callback);
    }
    static public void addFriend(String fId, TQImCallback callback){
        Map<String, String> param = new HashMap<>();
        param.put("inviteeid", fId);

        TQImHttpBase.client().post("/user/contacts/fadd", param, callback);
    }
    static public void rmFriend(String fId, TQImCallback callback){
        Map<String, String> param = new HashMap<>();
        param.put("contactsid", fId);

        TQImHttpBase.client().post("/user/contacts/rm", param, callback);
    }

    //(结尾的 / 不可省略)
    static public void getGoupList(TQImCallback callback){
        TQImHttpBase.client().get("/chatgroup/ ", null, callback);
    }

    static public void addNewGroup(String groupName, TQImCallback callback){
        Map<String, String> param = new HashMap<>();
        param.put("gname", groupName);
        TQImHttpBase.client().post("/chatgroup/new", param, callback);
    }

    static public void getGroupMember(String gId, TQImCallback callback){
        Map<String, String> param = new HashMap<>();
        param.put("gid", gId);
        TQImHttpBase.client().post("/chatgroup/mem", param, callback);
    }
    static public void addGroupMem(String gId, String mId, TQImCallback callback){
        Map<String, String> param = new HashMap<>();
        param.put("gid", gId);
        param.put("uid", mId);
        TQImHttpBase.client().post("/chatgroup/mem/add", param, callback);
    }
    static public void rmGroupMem(String gId, String mId, TQImCallback callback){
        Map<String, String> param = new HashMap<>();
        param.put("gid", gId);
        param.put("uid", mId);
        TQImHttpBase.client().post("/chatgroup/mem/rm", param, callback);
    }
}
